package cn.rongdao.jrkabao.ui.cashadvance.adapter;

import android.content.Context;
import android.view.ViewGroup;

import com.mifengkong.frtools.ui.adapter.recyclerview.FRBaseRecyclerAdapter;
import com.mifengkong.frtools.inputmethod.FRView;

import cn.rongdao.jrkabao.R;
import cn.rongdao.jrkabao.bean.cashadvance.CashByCreditCardBean;

/**
 * Created by jack on 2017/11/6
 */

public class DialogSelectFeeAdapter extends FRBaseRecyclerAdapter<CashByCreditCardBean.PassWay, DialogSelectFeeViewHolder> {

    public DialogSelectFeeAdapter(Context context, OnItemClickListener<DialogSelectFeeViewHolder> listener) {
        super(context, listener);
    }

    @Override
    public DialogSelectFeeViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new DialogSelectFeeViewHolder(FRView.inflateLayout(getContext(), R.layout.item_select_fee, parent, false));
    }

    public void setSelectFee(int position, String money) {
        for (int i = 0; i < getDataList().size(); i++) {
            getDataList().get(i).setSelect(false);
            getDataList().get(i).setMoney(money);
        }
        if (position>=0){
            getDataList().get(position).setSelect(true);
        }
        notifyDataSetChanged();
    }
}
